<?php
define('_USE_DB'    , 1);
// URL 变量预处理
$mod    = @trim($_GET['mod']);
$action = @trim($_GET['action']);
$save   = @(int)$_REQUEST['save'];

empty($mod) && ($mod == '') && $mod = 'admin';
empty($action) && ($action == '') && $action = 'index';

require(dirname(__FILE__) . '/../includes/global.php');
require($G_abs_includes . '/adminbase.lib.php');
require($G_abs_includes . '/time.lib.php');
require($G_abs_includes . '/tree.lib.php');

// 包含内容分类
$file_name  = $cfg_cache['cache_abspath'] . '/' .
                $cfg_cache['content_class_cache_filename'];
$class_var  = $cfg_cache['content_class_cache_var'];
if(file_exists($file_name)) {
    require($file_name);
} else {
    $$class_var = array();
}

// 获得当前栏目值
$cata       = @(int)$_GET['cata'];      // 当前主栏目ID
$cata_info  = array('cata_type' => 0);  // 当前主栏目详细信息
$cata_keylang   = '文章';               // 当前主栏目语言关键字
if($cata > 0) {
    $cata_info      = get_node_info($$class_var, $cata);
    $cata_keylang   = $cata_info['cata_keylang'];
}

// 现在这样处理。稍后应该根据$mod 和 $action 动态载入
require_once(dirname(__FILE__) . '/modules/admin/mod.conf.php');
$modules_path = dirname(__FILE__) . '/modules/' . $mod . '/mod.conf.php';
if(file_exists($modules_path)) require_once($modules_path);
$url_global = array(
    'common'        => $G_app_root . '/common',
    'admin_cp'      => $G_app_root . '/' . $admin_dir . '/' . $admin_file,
    'admin_cpdir'   => $G_app_root . '/' . $admin_dir,
    'admin_main'    => $G_app_root . '/' . $admin_dir . '/main.php',
    'admin_theme'   => $G_app_root . '/' . $admin_dir . '/themes/default',
    );
$url_global['admin_login']  = $url_global['admin_cp'] . '?mod=admin&action=u.login';
$url_global['admin_logout'] = $url_global['admin_cp'] . '?mod=admin&action=u.logout';

$abs_admin_cppath   = $G_abs_root . '/' . $admin_dir;
$abs_admin_views    = $G_abs_root . '/modules/admin/views';
if(defined('IN_ADMIN') && IN_ADMIN) {
    require($G_abs_includes . '/session.php');
}

$admin_theme = '/themes/default';
require('menu.inc.php');
?>